2005-07-13 Matthias Clasen <mclasen@redhat.com>
+ * gtk/gtkicontheme.c (load_themes): Don't keep the caches
+ for unthemed directories in a separate list, instead append
+ them at the end of the dir_mtimes list, so that we can check
+ them for staleness like the other caches. (#310221, Mark
+ McLoughlin)
+
* configure.in: Check that we have a new enough Cairo.
2005-07-13 Robert Ögren <gtk@roboros.com>
2005-07-13 Matthias Clasen <mclasen@redhat.com>
+ * gtk/gtkicontheme.c (load_themes): Don't keep the caches
+ for unthemed directories in a separate list, instead append
+ them at the end of the dir_mtimes list, so that we can check
+ them for staleness like the other caches. (#310221, Mark
+ McLoughlin)
+
* configure.in: Check that we have a new enough Cairo.
2005-07-13 Robert Ögren <gtk@roboros.com>
2005-07-13 Matthias Clasen <mclasen@redhat.com>
+ * gtk/gtkicontheme.c (load_themes): Don't keep the caches
+ for unthemed directories in a separate list, instead append
+ them at the end of the dir_mtimes list, so that we can check
+ them for staleness like the other caches. (#310221, Mark
+ McLoughlin)
+
* configure.in: Check that we have a new enough Cairo.
2005-07-13 Robert Ögren <gtk@roboros.com>
*/
GList *themes;
GHashTable *unthemed_icons;
- GList *unthemed_icons_caches;
/* Note: The keys of this hashtable are owned by the
* themedir and unthemed hashtables.
priv->themes_valid = FALSE;
priv->themes = NULL;
priv->unthemed_icons = NULL;
- priv->unthemed_icons_caches = NULL;
priv->pixbuf_supports_svg = pixbuf_supports_svg ();
}
}
}
-static void
-free_cache (gpointer data,
- gpointer user_data)
-{
- GtkIconCache *cache = (GtkIconCache *)data;
-
- if (cache)
- _gtk_icon_cache_unref (cache);
-}
-
static void
blow_themes (GtkIconTheme *icon_theme)
{
g_list_foreach (priv->dir_mtimes, (GFunc)free_dir_mtime, NULL);
g_list_free (priv->dir_mtimes);
g_hash_table_destroy (priv->unthemed_icons);
- if (priv->unthemed_icons_caches)
- g_list_foreach (priv->unthemed_icons_caches, free_cache, NULL);
- g_list_free (priv->unthemed_icons_caches);
}
priv->themes = NULL;
priv->unthemed_icons = NULL;
- priv->unthemed_icons_caches = NULL;
priv->dir_mtimes = NULL;
priv->all_icons = NULL;
priv->themes_valid = FALSE;
UnthemedIcon *unthemed_icon;
IconSuffix old_suffix, new_suffix;
GTimeVal tv;
+ IconThemeDirMtime *dir_mtime;
+ struct stat stat_buf;
priv = icon_theme->priv;
for (base = 0; base < icon_theme->priv->search_path_len; base++)
{
- GtkIconCache *cache;
dir = icon_theme->priv->search_path[base];
- cache = _gtk_icon_cache_new_for_path (dir);
+ dir_mtime = g_new (IconThemeDirMtime, 1);
+ dir_mtime->cache = _gtk_icon_cache_new_for_path (dir);
+ dir_mtime->dir = g_strdup (dir);
+ if (g_stat (dir, &stat_buf) == 0 && S_ISDIR (stat_buf.st_mode))
+ dir_mtime->mtime = stat_buf.st_mtime;
+ else
+ dir_mtime->mtime = 0;
+
+ priv->dir_mtimes = g_list_append (priv->dir_mtimes, dir_mtime);
- if (cache != NULL)
- {
- priv->unthemed_icons_caches = g_list_prepend (priv->unthemed_icons_caches, cache);
+ if (dir_mtime->cache != NULL)
+ continue;
- continue;
- }
-
gdir = g_dir_open (dir, 0, NULL);
if (gdir == NULL)
return TRUE;
}
- for (l = priv->unthemed_icons_caches; l; l = l->next)
- {
- GtkIconCache *cache = (GtkIconCache *)l->data;
-
- if (_gtk_icon_cache_has_icon (cache, icon_name))
- return TRUE;
- }
-
if (g_hash_table_lookup_extended (priv->all_icons,
icon_name, NULL, NULL))
return TRUE;